<template>
  <yd-layout>
    <!-- 顶部导航 -->
    <yd-navbar slot="navbar" title="商品列表" height=".88rem" bgcolor="#fff" color="#444" fontsize=".3rem">
      <yd-navbar-back-icon slot="left" color="#666" @click.native="$router.back()"></yd-navbar-back-icon>
    </yd-navbar>

    <!-- 内容 -->
    <w-empty v-if="!goodsList.length"></w-empty>
    <!-- 商品列表 -->
    <yd-list theme="1" v-else>
      <yd-list-item class="m-collect-item" v-for="(goods, index) in goodsList" :key="index" @click.native="$router.push(`/goods/${goods.goodsId}`)">
        <img slot="img" v-lazy="goods.path">
        <span slot="title">{{goods.goodsName}}</span>
        <yd-list-other slot="other">
          <div>
            <span class="yd-price"><em>¥</em>{{goods.storePrise | currency}}</span>
          </div>
          <div class="scale">月销{{goods.goodsSaleNum || 0}}件</div>
        </yd-list-other>
      </yd-list-item>
    </yd-list>

  </yd-layout>
</template>

<script>
  import { apiGoodsListByIds } from 'js/api'

  export default {
    data() {
      return {
        goodsList: []
      }
    },
    created() {
      const sList = this.$route.query.keyword || ''
      const aList = sList.split(',')
      apiGoodsListByIds(aList).then(data => {
        this.goodsList = (data || {}).goodsList || []
      })
    }
  }
</script>

<style lang="scss">
 
</style>